package com.dddd.blog.blogsp.config;

import org.springframework.stereotype.Component;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author 喵星球的大橘
 */
@Component
public class CrosConfig implements WebMvcConfigurer {

    @Override
    public void addCorsMappings(CorsRegistry registry) {
        registry.addMapping("/*")
                .allowCredentials(true)
                .allowedOrigins("*")
                .allowedMethods(new String[]{"GET","POST","DELETE","PUT"})
                .allowedHeaders("*")
                .exposedHeaders("/*");
    }
}
